package com.ymatou.app.rec.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*Pc端商品搜索接口Call
*FreeMaker Template自动生成代码
*/
public class SearchPcProductCall extends YmatouBaseCall{
	private static String opurl ="search/pcproduct";
	public SearchPcProductCall() {
		super(EnvSetup.getSystemUrl("SearchPcProduct"),opurl,"GET","PARAM");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取是否成功
	 * 
	 * @return String OK
	 */
	public String getSuccess() {
		String ok = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			ok = jo.getString("status");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return ok;
	}
	
	
	/**
	 * 接口是否超时 
	 * @return Bollean false
	 **/
	public Boolean getTimeOut(){
		Boolean timeouts = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			timeouts = jo.getBoolean("timeout");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return timeouts;
	}
}